﻿using System.Collections.Generic;
using Microsoft.Xna.Framework;

namespace Phoenix.Xna.Framework.Input
{
    /// <summary>
    /// Defines the interface for input device managers.
    /// </summary>
    internal interface IHumanInterfaceDevice
    {
        /// <summary>
        /// Gets the type of the interface device.
        /// </summary>
        DeviceType Type { get; }

        /// <summary>
        /// Gets the list of IInputMaps managed by the device.
        /// </summary>
        List<IInputMap> InputMaps { get; }

        /// <summary>
        /// Updates the interface device.
        /// </summary>
        /// <param name="gameTime">A snapshot of the elapsed game time.</param>
        void Update(GameTime gameTime);

        /// <summary>
        /// Registers a new IInputMap to be managed.
        /// </summary>
        /// <param name="map">The IInputMap to manage.</param>
        void RegisterMap(IInputMap map);

        /// <summary>
        /// Unregisters the specified IInputMap from the manager.
        /// </summary>
        /// <param name="map">The IInputMap to unregister.</param>
        void UnregisterMap(IInputMap map);

        /// <summary>
        /// Determins if the input device manages the specified IInputMap.
        /// </summary>
        /// <param name="map">The IInputMap to check for.</param>
        /// <returns>True if the map is managed, otherwise false.</returns>
        bool Contains(IInputMap map);

        /// <summary>
        /// Determins if the input device manages the specified IInputMap.
        /// </summary>
        /// <typeparam name="T">The type of the IInputMap to look for.</typeparam>
        /// <param name="map">The IInputMap to check for.</param>
        /// <returns>True if the map is managed, otherwise false.</returns>
        bool Contains<T>(T map);

        /// <summary>
        /// Determins if the input device manages the specified type of IInputMap.
        /// </summary>
        /// <typeparam name="T">The type of the IInputMap to check for.</typeparam>
        /// <returns>True if the type is managed, otherwise false.</returns>
        bool ContainsMapType<T>();

        /// <summary>
        /// Finds the first IInputMap that matches the specified type.
        /// </summary>
        /// <typeparam name="T">The type of IInputMap to look for.</typeparam>
        /// <returns>The first IInputMap of the specified type, otherwise null.</returns>
        T FirstOf<T>();
    }
}
